#使用须知：
# 1 创建文件夹 /data/temp/chicken
# 2 /data/web/chicken
# 3 ecosystem.config.cjs配置文件复制提前复制到 /data/web/chicken/ 下
# 4 git clone 替换成实际的账号密码
# 5 服务器需要安装git node pnpm

echo "auto deploy script start....."
cd /data/temp/chicken
git_file=bc-admin
echo "clone $git_file from git"
rm -rf $git_file/
git clone -b master https://13681295349:knightlzc1988@gitee.com/skyy001/bc-admin.git


cd /data/temp/chicken/$git_file

echo "start to install"

pnpm install

echo "start to package"

pnpm build

time=$(date +%Y%m%d%H%M%S)

cd /data/web/chicken

echo "bak $git_file "

mv .output ./output-$time

cp -r /data/temp/chicken/bc-fe/.output ./

echo "start up bc-fe"
pm2 start ./ecosystem.config.cjs

